package com.mentalhealthplatform.studentV3.ai.jimmer;

import cn.hutool.core.util.IdUtil;
import jakarta.persistence.AttributeConverter;
import jakarta.persistence.Converter;

@Converter(autoApply = true)
public class UUIDIdGenerator implements AttributeConverter<String, String> {

    @Override
    public String convertToDatabaseColumn(String attribute) {
        return attribute != null ? attribute : IdUtil.fastSimpleUUID();
    }

    @Override
    public String convertToEntityAttribute(String dbData) {
        return dbData;
    }
}